<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Annuity_user_model extends MY_Model{
	
	public function __construct(){
		parent::__construct();
	}
	
	public function dict_options($key = null, $index = null){
		$return = array(
			'level' => [
				'1' => [
					'label' => '一级',
					'bonus' => 1500
				],
				'2' => [
					'label' => '二级',
					'bonus' => 1000
				],
				'3' => [
					'label' => '三级',
					'bonus' => 500
				]
			],
			'status' => [
				'1' => '正常',
				'0' => '失效'
			]
		);
		if($key !== null){
			$return = $return[$key];
		}
		if($index !== null){
			$return = $return[$index];
		}
		return $return;
	}
	
	public function get_row($cond = array(), $field = null){
		$return = parent::get_row($cond, $field);
		if($return){
			if(isset($return['level'])){
				$return['level_info'] = $this->dict_options('level', $return['level']);
			}
		}
		return $return;
	}
	
}